<link href="<?php echo URL::base() ?>media/vendor/css/ui-lightness/jquery-ui-1.10.4.custom.css" rel="stylesheet">
<script src="<?php echo URL::base() ?>media/vendor/js/jquery-1.7.1.min.js"></script>
<script src="<?php echo URL::base() ?>media/vendor/js/jquery.ui.core.min.js"></script>
<script src="<?php echo URL::base() ?>media/vendor/js/jquery.ui.widget.min.js"></script>
<script src="<?php echo URL::base() ?>media/vendor/js/jquery.ui.position.min.js"></script>
<script src="<?php echo URL::base() ?>media/vendor/js/jquery.ui.autocomplete.min.js"></script>
<script src="<?php echo URL::base() ?>media/vendor/js/jquery-1.7.1.min.js"></script>
<script src="<?php echo URL::base() ?>media/vendor/js/jquery-ui-1.10.4.custom.js"></script>
<script src="<?php echo URL::base() ?>media/vendor/js/jquery-ui-timepicker-addon.min.js"></script>
<script src="<?php echo URL::base() ?>media/vendor/js/jquery-ui-timepicker-zh-CN.js"></script>
<script src="<?php echo URL::base() ?>media/vendor/js/jquery.ui.datepicker-zh-TW.js"></script>
<script src="<?php echo URL::base() ?>media/vendor/js/Validform_v5.3.2_ncr_min.js"></script>
<script src="<?php echo URL::base() ?>media/vendor/artdialog/jquery.artDialog.js"></script>
<script>
/**
 * 显示供应商列表
 */
function show_supplier_lists(supplier_data) {
    if (supplier_data.supplier_view) {
        $("#supplier_id").empty();
        $("#supplier_id").append(supplier_data.supplier_view);
    }
}

/**
 * 显示供应商详细信息
 */
function show_supplier_info(supplier_info) {
    if (supplier_info.supplier_contanct) {
        /**
         * 修改替换联系人选择框
         */
        $("#supplier_contact").empty();
        $("#supplier_contact").append(supplier_info.supplier_contanct);
    }

    if (supplier_info.supplier_payway) {
        /**
         * 修改替换付款方式选择框
         */
        $("#select_payway").empty();
        $("#select_payway").append(supplier_info.supplier_payway);
    }


    if (supplier_info.supplier_paybank) {
        /**
         * 修改替换付款帐号选择框
         */
        $("#select_paybankinfo").empty();
        $("#select_paybankinfo").append(supplier_info.supplier_paybank);
    }

    if(supplier_info.coinid) {
        if(supplier_info.coinid != 1) {
            $(".rateTypeControl").removeClass("hidden");
        }
    }
}

function show_supplier_sku_info(supplier_sku_info) {
    var id = 1;
    if (supplier_sku_info) {
        if (supplier_sku_info.sku) {
            $("#" + id).children().eq(0).find("input").val(supplier_sku_info.sku);
        }
        if (supplier_sku_info.sku_name) {
            $("#" + id).children().eq(1).text(supplier_sku_info.sku_name);
        }
        if (supplier_sku_info.nuit) {
            $("#" + id).children().eq(2).text(supplier_sku_info.nuit);
        }
        if (supplier_sku_info.place) {
            $("#" + id).children().eq(3).text(supplier_sku_info.place);
        }
        if (supplier_sku_info.price) {
            $("#" + id).children().eq(5).find("input").val(supplier_sku_info.price);
        }
        if (supplier_sku_info.delivery) {
            $("#" + id).children().eq(9).find("input").val(supplier_sku_info.delivery);
        }
        if (supplier_sku_info.sku_price) {
            $("#" + id).children().eq(10).text(supplier_sku_info.sku_price);
        }
        if (supplier_sku_info.status) {
            $("#" + id).children().eq(11).text(supplier_sku_info.status);
        }
    }
}

/**
 * 获取供应商sku信息，以及sku信息
 */
function get_supplier_sku_info(supplier_id, sku) {

    if (supplier_id
        && sku) {
        $.ajax(
            {
                type: 'post',
                url: '<?php echo url::base(true)?>purchase/getskuinfo',
                dataType: 'json',
                data: {"supplier_id": supplier_id, "sku": sku},
                async: false,
                success: function (re_data) {
                    if (re_data) {
                        show_supplier_sku_info(re_data);
                    }
                },
                error: function () {
                }
            }
        );
    }
}
/**
 * 根据供应商名称查询供应商的信息
 * @param supplier_id
 */
function get_supplier_info(supplier_id) {
    if (supplier_id) {
        $.ajax(
            {
                type: 'post',
                url: '<?php echo url::base(true)?>purchase/supplierpayway',
                dataType: 'json',
                data: {"supplier_id": supplier_id},
                async: false,
                success: function (re_data) {
                    if (re_data) {
                        show_supplier_info(re_data);
                    }
                },
                error: function () {
                }
            }
        );
    }
}

/**
 * 通过sku查询供应商和sku信息
 */
function select_sku_supplier(sku, su_id) {
    $.ajax(
        {
            type: 'post',
            url: '<?php echo url::base(true)?>purchase/getSupplierInfoByIdAndSku',
            dataType: 'json',
            data: {"sku": sku,'su_id':su_id},
            async: false,
            success: function (re_data) {
                if (re_data) {
                    /**
                     * 显示供应商列表
                     */
                    show_supplier_lists(re_data);
                    get_supplier_info(su_id);
                    get_supplier_sku_info(su_id, sku);
                }

            },
            error: function () {
            }
        }
    );
}

/**
 * 选择供应商事件处理
 */
function select_supplier(obj) {
    var sku = $("#sku_input").val();
    var supplier_id = $(obj).val();
    get_supplier_info(supplier_id);
    get_supplier_sku_info(supplier_id, sku);
}
/**
 * 获取创建采购单的供应商信息
 */
function get_purchase_info_supplier() {
    var supplier_id = $('#supplier_id').val();
    if (supplier_id == 0) {
//      alert('请选择供应商');return false;
    }

    var supplier_contact = $("#supplier_contact").val();
    if (supplier_contact == 0) {
//        alert('请选择供应商联系人');return false;
    }
    var select_payway = $("#select_payway").val();
    if (select_payway == 0) {
//        alert('请选择供应商付款方式');return false;
    }

    var select_paybankinfo = $("#select_paybankinfo").val();
    if (select_paybankinfo == 0) {
//        alert('请选择供应商付款帐号');return false;
    }

    var coinRate = 0;
    var rateType = 0;
    if($(".rateTypeControl").hasClass("hidden")) {
    }else{
        var rateType = $("#rateType").val();
        if(rateType == 0) {
            alert('请选择汇率类型');
            return false;
        }

        if(rateType == 40) {
            if($("#coinRate").val() != 0 && $("#coinRate").val()){
                coinRate = $("#coinRate").val();
            }else{
                alert('请填写汇率值');
                return false;
            }
        }
    }

    var remark = $("#remark").val();
    var transportation_expense = $("#transportation_expense").val();

    //var coin = $("#coin").val();
    /**
     *  供应商信息
     *  供应商id
     *  付款方式id
     *  付款帐号id
     *  运费
     *  备注
     */
    var supplier_info = {"supplier_id": supplier_id,
        "contact_id": supplier_contact,
        "pay_way": select_payway,
        "payaccountinfo_id": select_paybankinfo,
        "transportation_expense": transportation_expense,
        "rateType":rateType,
        "coinRate": coinRate,
        "remark": remark,
        "createtype": 2
    };

    return supplier_info;
}

/**
 *  获取某一行的数据
 *
 */
function get_purchase_sku_info_row(id) {
    if ($("#" + id).children('td').find('input').attr('readonly')) {
        var sku_info = {
            "sku": $("#" + id).children('td').eq(0).find("input").val(),
            "sku_name": $("#" + id).children('td').eq(1).text(),
            "storage_position": $("#" + id).children('td').eq(3).text(),
            "sku_standard": "",
            "quantity": $("#" + id).children('td').eq(6).find('input').val(),
            "single_price": $("#" + id).children('td').eq(5).find('input').val(),
            "tax_rate": $("#" + id).children('td').eq(7).find('input').val(),
            "remark": "",
            "arrive_date": $("#" + id).children('td').eq(9).find('input').val(),
            "tax_way": $("#" + id).children('td').eq(4).find("select").val(),
            "sku_unit": $("#" + id).children('td').eq(1).text(),
            "prime_cost": $("#" + id).children('td').eq(10).text(),
            "supplier": $('#supplier_id').val()
        }

        return sku_info;
    }
    else {
        return false;
    }
}


/**
 * 获取采购单的SKU信息
 */
function get_purchase_sku_info() {
    var sku_info_arr = [];
    $("#row").children('tr').each(function () {
        var id = $(this).attr('id');
        if ($("#" + id).children('td').eq(6).find('input').val() == '') {
            sku_info_arr = '';
            return;
        }
        var sku_info = get_purchase_sku_info_row($(this).attr('id'));
        if (sku_info) {
            sku_info_arr.push(sku_info);
        }
    });

    if (sku_info_arr) {
        return sku_info_arr;
    }
    else {
        alert('数量不能为空');
        return false;
    }
}

function init_view() {
    var sku = $("#sku_input").val();
    var su_id = $("#supplier_id").val();
    $("#input_sku").attr("readonly", "readonly");
    select_sku_supplier(sku,su_id);
    return false;
}

/**
 * 获取计算金额的信息
 */
function get_money_info(obj) {
    var id = $(obj).parent('td').parent('tr').attr('id');

    if (!$("#" + id).children('td').eq(0).find('input').attr('readonly')) {
        return false;
    }
    var money_info = {
        "quantity": $("#" + id).children('td').eq(6).find('input').val(),
        "single_price": $("#" + id).children('td').eq(5).find('input').val(),
        "tax_rate": $("#" + id).children('td').eq(7).find('input').val(),
        "tax_way": $("#" + id).children('td').eq(4).find("select").val()
    }

    return money_info;
}

function show_money(obj, money) {
    if (money) {
        var id = $(obj).parent('td').parent('tr').attr('id');
        $("#" + id).children('td').eq(5).find('input').val(money.single_price);
        $("#" + id).children('td').eq(6).find('input').val(money.quantity);
        $("#" + id).children('td').eq(7).find('input').val(money.tax_rate);
        $("#" + id).children('td').eq(8).find('input').val(money.money);
    }
}

function check_single_price(obj) {
    var id = $(obj).parent('td').parent('tr').attr('id');

    if (!$("#" + id).children('td').eq(0).find('input').attr('readonly')) {
        return false;
    }
    var sku = $("#" + id).children('td').eq(0).find("input").val();
    var single_price = $("#" + id).children('td').eq(5).find('input').val();

    if (single_price) {
        $.ajax(
            {
                type: 'post',
                url: '<?php echo url::base(true)?>purchase/check_single_price',
                dataType: 'json',
                data: {"single_price": single_price, 'sku': sku},
                async: false,
                success: function (re_data) {
                    if (re_data.code == 2) {
                        alert('注意：单价高于基础资料系统单价');
                    }
                },
                error: function () {
                }
            }
        );
    }
}

function check_sku_status(obj) {
    var id = $(obj).parent('td').parent('tr').attr('id');

    if (!$("#" + id).children('td').eq(0).find('input').attr('readonly')) {
        return false;
    }
    var sku = $("#" + id).children('td').eq(0).find("input").val();
    $.ajax(
        {
            type: 'post',
            url: '<?php echo url::base(true)?>purchase/check_sku_status',
            dataType: 'json',
            data: {'sku': sku},
            async: false,
            success: function (re_data) {
                if (re_data.code == 2) {
                    alert(re_data.mes);
                }
            },
            error: function () {
                alert('系统错误');
            }
        }
    );
}


/**
 * 计算价格与基础资料价格进行比较，如果大于，则不允许下单
 */
function count_money_and_price(obj) {
    check_single_price(obj);
    var money_info = get_money_info(obj);
    if (money_info) {
        $.ajax(
            {
                type: 'post',
                url: '<?php echo url::base(true)?>purchase/count_money',
                dataType: 'json',
                data: {"money_info": money_info},
                async: false,
                success: function (re_data) {
                    if (re_data) {
                        show_money(obj, re_data);
                    }
                },
                error: function () {
                }
            }
        );
    }
}
//输入数量后提示
function count_money_in_count(obj) {
    var td_single_price = $(obj).parent().prev().find("input");
    check_sku_status(td_single_price);

    check_single_price(td_single_price);
    var money_info = get_money_info(obj);
    if (money_info) {
        $.ajax(
            {
                type: 'post',
                url: '<?php echo url::base(true)?>purchase/count_money',
                dataType: 'json',
                data: {"money_info": money_info},
                async: false,
                success: function (re_data) {
                    if (re_data) {
                        show_money(obj, re_data);
                    }
                },
                error: function () {
                }
            }
        );
        //num_blur();
    }
}


/**
 * 重新计算金额
 */
function count_money(obj) {

    var money_info = get_money_info(obj);
    if (money_info) {
        $.ajax(
            {
                type: 'post',
                url: '<?php echo url::base(true)?>purchase/count_money',
                dataType: 'json',
                data: {"money_info": money_info},
                async: false,
                success: function (re_data) {
                    if (re_data) {
                        show_money(obj, re_data);
                    }
                },
                error: function () {
                }
            }
        );
    }
}

function change_txt(money, coin) {
    return '财务需折算为' + coin +'付款，汇率以付款当天汇率为准。';
}

//修改运费后备注自动加上
function text_money_change(obj) {
    if($(".all_m").length) {
        var coin = $("#coin").val();
        if(parseInt(coin) > 1) {
            var f = 0;
            $(".all_m").each(function(){
                if(parseFloat($(this).children("input").eq(0).val())) {
                    f += parseFloat($(this).children("input").eq(0).val());
                }
            });
            if(f) {
                var coin_name = $("#coin").children("option[value='" + coin +"']").text();
                f += parseFloat($(obj).val());
                $("#remark").val(change_txt(f, coin_name));
            }
        }
    }
}

function coin_change(obj) {
    //判断是否有有效的SKU行
    if($(obj).val()<=1) {
        var reg=/^.*?当天汇率.*?$/;
        if(reg.test($("#remark").val())) {
            if(window.confirm("确定修改为非外币吗，修改后备注将清空？")) {
                $("#remark").val("");
            }
        }
        return;
    }

    if($(".all_m").length) {
        var f = 0;
        $(".all_m").each(function(){
            if(parseFloat($(this).children("input").eq(0).val())) {
                f += parseFloat($(this).children("input").eq(0).val());
            }
        });
        if(f) {
            var coin = $(obj).val();
            var coin_name = $(obj).children("option[value='" + coin +"']").text();
            f += parseFloat($("#transportation_expense").val());
            $("#remark").val(change_txt(f, coin_name));
        }
    }
}

function num_blur() {
    //有数量的时候判断币种
    if($(".all_m").length) {
        var coin = $("#coin").val();
        if(parseInt(coin) > 1) {
            var f = 0;
            $(".all_m").each(function(){
                if(parseFloat($(this).children("input").eq(0).val())) {
                    f += parseFloat($(this).children("input").eq(0).val());
                }
            });
            if(f) {
                var coin_name = $("#coin").children("option[value='" + coin +"']").text();
                f += parseFloat($("#transportation_expense").val());
                $("#remark").val(change_txt(f, coin_name));
            }
        }
    }
}

function coinOrNot() {
    if($("#coin").val()==0) {
        alert("请选择付款币种");
        return false;
    }
    return true;
}

$(document).ready(function () {

    init_view();
    /**
     * 设置时间控件
     */
    $.datepicker.setDefaults({ dateFormat: 'yy-mm-dd' });

    $(document).on('focus', ".datepicker", function (e) {
        $(this).datepicker({
            minDate: new Date()
        });
    });


    $("#tijiao").click(function () {

        var supplier_info = get_purchase_info_supplier();
        //if(!coinOrNot())return false;
        supplier_info.pay_way = $('.payway_id').val();
        supplier_info.contact_id = $('.contact_id').val();
        supplier_info.payaccountinfo_id = $('.payaccountinfo_id').val();
        var sku_info = get_purchase_sku_info();

        if (supplier_info && sku_info) {
            $.ajax(
                {
                    type: 'post',
                    url: '<?php echo url::base(true)?>purchase/createpurchasenew',
                    dataType: 'json',
                    data: {"purchaseorders": supplier_info, "purchaseorder_details": sku_info},
                    async: false,
                    success: function (re_data) {
                        if (re_data.code == 2) {
                            var tips = '创建成功，采购单号' + re_data.id;
                            alert(tips);
                            window.location.href = "<?php echo url::base()?>sirens";
                            //window.location.reload();
                            //globe_dialog.close();
                            //globe_dialog = {};
                        }
                    },
                    error: function () {
                    }
                }
            );
        }
    });

    $("#select_paybankinfo").change(function(){
        var reg=/^.*?人民币.*?$/;
        if(reg.test($(this).find("option:selected").text())) {
            $(".rateTypeControl").addClass("hidden");
        }else{
            $(".rateTypeControl").removeClass("hidden");
        }
    });

    $("#rateType").change(function(){
        if($(this).val() == 40){
            $(".rateControl").removeClass('hidden');
        }else{
            $(".rateControl").addClass('hidden');
        }
    });

});
</script>

<table class="table table-bordered" style="table-layout:fixed;">
    <tbody>
    <tr style=" background-color:#4EA392;color:#fff;">
        <th>
            SKU
        </th>
        <th>
            中文名称
        </th>
        <th>
            实际可用库存
        </th>
        <th>
            在途库存
        </th>
        <th>
            日均销量
        </th>
        <th>
            可支持天数
        </th>
        <th>
            最佳下单日期
        </th>
        <th>
            建议采购量
        </th>
    </tr>

    <?php if(isset($skulists) and $skulists){ ?>
        <tr>
            <th>
                <?php echo isset($skulists['sku'])?$skulists['sku']:'' ?>
            </th>
            <th>
                <!--中文名称-->
                <?php echo isset($skulists['sku_name'])?$skulists['sku_name']:'' ?>
            </th>
            <th>
                <!--实际可用库存-->
                <?php echo isset($skulists['actual'])?$skulists['actual']:'' ?>
            </th>
            <th>
                <!--在途库存-->
                <?php echo isset($skulists['onway'])?$skulists['onway']:'' ?>
            </th>
            <th>
                <!--日均销量-->
                <?php echo isset($skulists['daysale'])?$skulists['daysale']:'' ?>
            </th>
            <th>
                <!--可支持天数-->
                <?php echo isset($skulists['sup_sec_name'])?$skulists['sup_sec_name']:'' ?>
            </th>
            <th>
                <!--最佳下单日期-->
                <?php echo isset($skulists['do_sec_name'])?$skulists['do_sec_name']:'' ?>
            </th>
            <th>
                <!--建议采购量-->
                <?php $do = $skulists['daysale']*(($skulists['ldt_sec']-$skulists['sup_sec'])/(60*60*24)+10);
                if($do>0){
                    echo ceil($do);
                }else{
                    echo 0;
                } ?>
            </th>
        </tr>
    <?php } ?>
</table>
</div>

<div class="form-horizontal">
    <input type="hidden" id="sku_input" value="<?php echo $_GET['sku'] ?>">

    <div class="control-group">
        <label class="control-label" for="supplier_name">供应商:</label>

        <div class="controls" id="group">
            <input type="hidden" value="<?php echo isset($supplier_id)?$supplier_id:''; ?>" id="supplier_id"
                   name="supplier_name"/>
            <input type="text" class="input-xlarge"
                   value="<?php echo isset($supplier_for_sku['name'])?$supplier_for_sku['name']:''; ?>"
                   readonly="readonly"/>
        </div>
    </div>
    <div class="control-group" id="select_supplier_contact_div">
        <label class="control-label" for="supplier_contact">联系人:</label>

        <div class="controls">
            <input type="hidden" class="contact_id" value="<?php echo isset($contacts_info[0]['id'])?$contacts_info[0]['id']:'';?>">
            <input type="text" class="input-xlarge"
                   value="联系人:<?php echo isset($contacts_info[0]['contact'])?$contacts_info[0]['contact']:''; ?> 手机:<?php echo isset($contacts_info[0]['mobile'])?$contacts_info[0]['mobile']:''; ?> 电话:<?php echo isset($contacts_info[0]['phone'])?$contacts_info[0]['phone']:''; ?> QQ:<?php echo isset($contacts_info[0]['qq'])?$contacts_info[0]['qq']:''; ?>"
                   readonly="readonly" name="supplier_contact" id="supplier_contact"/>
        </div>
    </div>
    <div class="control-group" id="supplier_payway_div">
        <label class="control-label" for="input01">付款方式:</label>

        <div class="controls">
            <input type="hidden" class="payway_id" value="<?php echo isset($supplier_payways[0]['payways_id'])?$supplier_payways[0]['payways_id']:'';?>">
            <input type="text" class="input-xlarge"
                   value="<?php echo isset($supplier_payways[0]['paywayname'])?$supplier_payways[0]['paywayname']:''; ?>"
                   readonly="readonly" name="paytype" id="select_payway">
        </div>
    </div>
    <div class="control-group" id="select_paybankinfo_div">
        <label class="control-label" for="select_paybankinfo">付款帐号:</label>

        <div class="controls">
            <input type="hidden" class="payaccountinfo_id" value="<?php echo isset($supplier_payways[0]['payaccountinfo_id'])?$supplier_payways[0]['payaccountinfo_id']:''; ?>">
            <input class="input-xlarge" type="text"
                   value="<?php echo $payaccountinfo['coinid']."开户银行:".$payaccountinfo['bankname'].$payaccountinfo['bankaddress']." 户名:".$payaccountinfo['bankaccountname']." 帐号:".$payaccountinfo['bankaccount']." SWIFT:".$payaccountinfo['bankswift']; ?>"
                   readonly="readonly"
                   name="select_paybankinfo" id="select_paybankinfo"/>
        </div>
    </div>

    <div class="control-group">
        <label class="control-label" for="input01">运费:</label>

        <div class="controls">
            <input type="text" class="input-xlarge" onkeyup="clearNoNum(this)" name="transportation_expense"
                   id="transportation_expense" value="0"/>
        </div>
    </div>
    <div class="control-group rateTypeControl hidden">
        <label class="control-label">汇率类型:</label>

        <div class="controls">
            <select id="rateType" name="rateType" class="input-xlarge" style="width: 284px"">
            <option value="0">请选择汇率类型</option>
            <?php foreach($types as $tId=>$t){?>
                <option value="<?php echo $tId;?>"><?php echo $t;?></option>
            <?php }?>
            </select>
        </div>
    </div>
    <div class="control-group rateControl hidden">
        <label class="control-label">汇率值:</label>

        <div class="controls">
            <input type="text" class="input-xlarge" onkeyup="clearNoNum(this)" name="coinRate"
                   autocomplete="off"
                   id="coinRate" value="0"/>
        </div>
    </div>
    <div class="control-group">

        <!-- Textarea -->
        <label class="control-label">备注:</label>

        <div class="controls">
            <textarea type="" class="" style="margin: 0px; width: 272px; height: 90px;resize:none;" name="remark"
                      id="remark"> </textarea>
        </div>
    </div>
    <div class="control-group" style="display:none">
        <label class="control-label" for="input01"></label>

        <div class="controls">
            <input type="text" class="input-xlarge" name="supplier" id="supplier" value=""/>
        </div>
    </div>
</div>
<table class="table table1 table-hover table-striped table-condensed">
    <thead>
    <tr style="  background-color:#4EA392; color:#fff;">

        <th>
            SKU
        </th>
        <th>
            中文名称
        </th>
        <th>
            单位
        </th>
        <th>
            储位
        </th>
        <th>
            计税方式
        </th>
        <th>
            单价<span style="color: red">￥</span>
        </th>
        <th>
            数量
        </th>
        <th>
            税率
        </th>
        <th>
            金额
        </th>
        <th>
            交货日期
        </th>
        <th>
            系统成本价
        </th>
        <th>
            状态
        </th>


    </tr>
    </thead>
    <tbody id="row">
    <tr id="1">

        <td>
            <input style="width:70px;" class="input-mini sku_input" type="text" id="input_sku"
                   value="" autocomplete="off" readonly="readonly"
                />
        </td>
        <td>

        </td>
        <td>

        </td>
        <td>

        </td>

        <td>
            <select class="input-xlarge tax_way" name="tax_way" id="tax_way" style="width: 75px" autocomplete="off"
                    onchange="count_money(this)">
                <option value="0">不计税</option>
                <option value="-1">内含税</option>
                <option value="1">外加税</option>
            </select>
        </td>
        <td>
            <input class="input-mini" type="text" value='' style="width:40px" onblur="count_money_and_price(this)"
                   autocomplete="off"/>
        </td>
        <td>
            <input class="input-mini" type="text" value='' style="width:40px" onblur="count_money_in_count(this)"
                   autocomplete="off"
                />
        </td>
        <td>
            <input class="input-mini tax_rate" type="text" value='0' autocomplete="off" onblur="count_money(this)"/>%
        </td>
        <td class="all_m">
            <input class="input-mini" type="text" value='' disabled="disabled" autocomplete="off"/>
        </td>
        <td>
            <input class="input-mini datepicker" type="text"
                   value=""
                   style="width:80px" autocomplete="off"/>
        </td>
        <td>

        </td>
        <td>

        </td>

    </tr>

    </tbody>

</table>
<button id="tijiao" class="btn btn-info" style="margin-left:10px;">一键创建</button>
